package com.water.service.impl;

import com.water.dao.BeOrderDao;
import com.water.entity.BeOrder;
import com.water.service.BeOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (BeOrder)表服务实现类
 *
 * @author makejava
 * @since 2020-12-14 19:18:46
 */
@Service("beOrderService")
public class BeOrderServiceImpl implements BeOrderService {
    @Resource
    private BeOrderDao beOrderDao;

    /**
     * 通过ID查询单条数据
     *
     * @param orderno 主键
     * @return 实例对象
     */
    @Override
    public BeOrder queryById(String orderno) {
        return this.beOrderDao.queryById(orderno);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<BeOrder> queryAllByLimit(int offset, int limit) {
        return this.beOrderDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<BeOrder> queryAll(BeOrder beOrder) {
        return this.beOrderDao.queryAll(beOrder);
    }

    /**
     * 新增数据
     *
     * @param beOrder 实例对象
     * @return 实例对象
     */
    @Override
    public BeOrder insert(BeOrder beOrder) {
        this.beOrderDao.insert(beOrder);
        return beOrder;
    }

    /**
     * 修改数据
     *
     * @param beOrder 实例对象
     * @return 实例对象
     */
    @Override
    public BeOrder update(BeOrder beOrder) {
        this.beOrderDao.update(beOrder);
        return this.queryById(beOrder.getOrderno());
    }

    /**
     * 通过主键删除数据
     *
     * @param orderno 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String orderno) {
        return this.beOrderDao.deleteById(orderno) > 0;
    }

    /**
     * 工单管理
     * @param order
     * @return
     */
    @Override
    public List<Map<String, Object>> queryOrder(BeOrder order) {
        return beOrderDao.queryOrder(order);
    }

    @Override
    public String queryMaxOrd(String odtypr) {
        return beOrderDao.queryMaxOrd(odtypr);
    }

    @Override
    public Integer couOrder(BeOrder beOrder) {
        return this.beOrderDao.couOrder(beOrder);
    }

    @Override
    public String queryMaxUsNo(Integer syid){
        return this.beOrderDao.queryMaxUsNo(syid);
    }

    @Override
    public BeOrder findDing(String wxuserid) {
        return null;
    }
}